#include <jni.h>
#include <string>
#include "NDKPlayer.h"
#include "log.h"

JavaVM * vm;
jint JNI_OnLoad(JavaVM * vm ,void *args){
    ::vm = vm;
    LOGE("开始执行 JNI_OnLoad");
    return JNI_VERSION_1_6;
}

extern "C"
JNIEXPORT void JNICALL
Java_com_mrstage_ndkplayer_NDKPlayer_prepareNative(JNIEnv *env, jobject thiz, jstring data_source) {



    const char * data_source_ = env->GetStringUTFChars(data_source,0);

    JNICallbackHelp * jniCallbackHelp = new JNICallbackHelp(vm,env,thiz);



    auto *player = new NDKPlayer(data_source_,jniCallbackHelp);


    player->prepare();



    env->ReleaseStringUTFChars(data_source,data_source_);
}
extern "C"
JNIEXPORT void JNICALL
Java_com_mrstage_ndkplayer_NDKPlayer_startNative(JNIEnv *env, jobject thiz) {

}
extern "C"
JNIEXPORT void JNICALL
Java_com_mrstage_ndkplayer_NDKPlayer_stopNative(JNIEnv *env, jobject thiz) {

}
extern "C"
JNIEXPORT void JNICALL
Java_com_mrstage_ndkplayer_NDKPlayer_releaseNative(JNIEnv *env, jobject thiz) {

}